import sys
from PyQt4 import QtCore, QtGui
#from PyQt4.QtWebKit import *

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *

import time


from MainWindow import Ui_MainWindow


class MyForm(QtGui.QMainWindow):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        
        self.connect(self.ui.surfTo, QtCore.SIGNAL("clicked()"), self.onSurf)
        self.connect(self.ui.txt_adressBar, QtCore.SIGNAL("returnPressed()") , self.onSurf)
    def onSurf(self):
        
        url = self.ui.txt_adressBar.text()
        
        print url
        self.ui.webView.load(QUrl("http://" + url));
        self.ui.webView.show();
        

    def surf(self):
        self.ui.webView.load(QUrl("http://www.apple.de"));
        self.ui.webView.show();

if __name__ == "__main__":
    app = QtGui.QApplication(sys.argv)
    myapp = MyForm()
    myapp.show()
    myapp.surf()
    sys.exit(app.exec_())